package elitech.vietnam.weatherfashion.custom;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import elitech.vietnam.weatherfashion.custom.imageviewzoom.ImageViewTouch;

public class ZoomImageView extends ImageViewTouch implements View.OnTouchListener {

	public ZoomImageView(Context context) {
		super(context);
		setListener();
	}
	
	public ZoomImageView ( Context context, AttributeSet attrs ) {
		super( context, attrs, 0 );
		setListener();
	}
	
	public ZoomImageView ( Context context, AttributeSet attrs, int defStyle ) {
		super( context, attrs, defStyle );
		setListener();
	}
	
	private void setListener() {
		setOnTouchListener(this);
	}

	@Override
	public boolean onTouch(View v, MotionEvent event) {
		if (getScale() > 1.0f)
			getParent().requestDisallowInterceptTouchEvent(true);
		else
			getParent().requestDisallowInterceptTouchEvent(false);
		return false;
	}

}
